package com.yx.learn.domain;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Usergroup entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tusergroup", catalog = "yx_01")
public class Usergroup implements java.io.Serializable {

	// Fields

	private Integer id;
	private Group group;
	private User user;
	private Timestamp expiredtime;
	private String memo;

	// Constructors

	/** default constructor */
	public Usergroup() {
	}

	/** minimal constructor */
	public Usergroup(Integer id, Group group, User user) {
		this.id = id;
		this.group = group;
		this.user = user;
	}

	/** full constructor */
	public Usergroup(Integer id, Group group, User user, Timestamp expiredtime,
			String memo) {
		this.id = id;
		this.group = group;
		this.user = user;
		this.expiredtime = expiredtime;
		this.memo = memo;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false)
	@GeneratedValue
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "groupID", nullable = false)
	public Group getGroup() {
		return this.group;
	}

	public void setGroup(Group group) {
		this.group = group;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userID", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "expiredtime", length = 0)
	public Timestamp getExpiredtime() {
		return this.expiredtime;
	}

	public void setExpiredtime(Timestamp expiredtime) {
		this.expiredtime = expiredtime;
	}

	@Column(name = "memo", length = 200)
	public String getMemo() {
		return this.memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

}